package com.sqxgg.drugstore.weatherReport.rest;


import com.sqxgg.drugstore.weatherReport.entity.WeatherResponse;
import com.sqxgg.drugstore.weatherReport.service.WeatherDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author: Lucifer
 * @create: 2018-09-23 23:45
 * @description:
 **/
@RestController
@RequestMapping(value = "/weather")
public class WeatherController {

    @Autowired
    private WeatherDataService weatherDataService;

    @GetMapping(value = "/cityId/{cityId}")
    public WeatherResponse getWeatherByCityId(@PathVariable("cityId") String cityId){
        return weatherDataService.getDataByCityId(cityId);
    }


    @RequestMapping(value = "/cityName/{cityName}", method = RequestMethod.GET)
    public WeatherResponse getWeatherByCityName(@PathVariable("cityName") String cityName){
        return weatherDataService.getDataByCityName(cityName);
    }
    @PostMapping({"/test"})
    public WeatherResponse sendEmail()
    {

        return weatherDataService.getDataByCityName("珠海");
    }

}